import request from "../utils/requistApi.js";

/**
 * 获取产品列表
 * @param {Object} param - 请求参数
 * @param {number} param.current - 当前页码，必填
 * @param {string} [param.lang = 'cn'] - 语言代码，默认'cn'
 * @param {string} [param.productIdCode] - 产品id加密
 * @returns {Promise} - 返回请求的Promise
 */
export function getProduct({
	current,
	lang,
	productIdCode
}) {
	return request({
		url: `/dpl/v2/products/${current}`,
		method: "get",
		data: {
			lang,
			productIdCode
		}
	});
}

// 获取产品id对应的款式列表
export function getProductStyle({
	lang,
	productId
}) {
	return request({
		url: `/dpl/v2/productsStyle/${productId}`,
		method: "get",
		data: {
			lang,
		}
	});
}

// 搜索产品
export function searchProduct({
	current,
	product_name
}) {
	return request({
		url: `/dpl/v2/products/search/${current}`,
		method: "get",
		data: {
			product_name,
		}
	});
}

// 搜索广场
export function searchFunplay({
	current,
	funpalytitle
}) {
	return request({
		url: `/dpl/v2/funplay/${current}`,
		method: "get",
		data: {
			funpalytitle,
		}
	});
}

// 搜索用户
export function searchAllUser({
	current,
	searchWord
}) {
	return request({
		url: `/dpl/v2/funplay/search/user/${current}`,
		method: "get",
		data: {
			searchWord,
		}
	});
}

//热门系列 
export function hotProduct() {
	return request({
		url: `/dpl/v2/products/recommend`,
		method: "get",
		data:{}
	});
}